﻿using System;
using DbTracker.Core.Schema.Model;

namespace DbTracker.MsSql.Model
{
    public class Function : Code
    {
        public Function()
            : base(ObjectType.Function, ScripActionType.AddFunction, ScripActionType.DropFunction)
        {

        }

        /// <summary>
        /// Clona el objeto en una nueva instancia.
        /// </summary>
        public override ISchema Clone()
        {
            var item = new Function
            {
                Text = Text,
                Status = Status,
                Name = Name,
                Id = Id,
                Owner = Owner,
                IsSchemaBinding = IsSchemaBinding
            };
            DependenciesIn.ForEach(dep => item.DependenciesIn.Add(dep));
            DependenciesOut.ForEach(dep => item.DependenciesOut.Add(dep));

            return item;
        }

        public override Boolean IsCodeType
        {
            get { return true; }
        }
    }
}